﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WebDummy
{
    public class Travian
    {
        private StringBuilder ServerAddress = new StringBuilder();
        private String Username;
        private String Password;

        private Logindetails Loginobj;
        private Statistics Statsobj;
        public Travian(String Server,String Username,String Password)
        {
            this.ServerAddress.Insert(0,Server);
            if (!this.ServerAddress.ToString().Contains(".php"))
                this.ServerAddress.Insert(this.ServerAddress.ToString().LastIndexOf('/')+1, "dorf1.php");
            this.Username = Username;
            this.Password = Password;
            Fetch.FetchPage(ServerAddress.ToString());
        }

        public void Login()
        {
            this.Loginobj = new Logindetails(this.ServerAddress.ToString());
            this.Loginobj.login(this.Username, this.Password,ServerAddress.ToString());
        }

        public void Statistics()
        {
            StringBuilder copy = ServerAddress;
            copy.Replace("dorf1.php","statistiken.php");
            Statsobj = new Statistics(copy.ToString());
            Statsobj.getrank("BloodyD", copy.ToString()); //Fetch.FetchPage(copy.ToString());
        }
    }
}
